package framework.gui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Window;

import javax.swing.BoxLayout;
import javax.swing.WindowConstants;

import framework.controller.*;
import framework.model.*;
import framework.view.*;

/**
 * This class is the entry point of the program. It shows the user the loginscreen.
 * @author Stephan Veenstra
 * @version 0.1
 */
public class LoginGUI extends GUI {

	private final String GUI_NAME 	= "Login screen";
	private final int GUI_WIDTH 	= 300;
	private final int GUI_HEIGHT 	= 150;
	
	private LoginController loginController;
	private LoginView loginView;
	private LoginModel loginModel;
	
	public LoginGUI(){
		this.setLoginModel();
		this.setLoginController();
		this.setLoginView();
		this.setPanels();
		this.init();
	}
	
	private void setPanels() {
		super.add(this.loginView);
	};
	
	private void setLoginView() {
		this.loginView = new LoginView(this.loginModel, this.loginController);
		this.loginModel.addListener(this.loginView);
	};
	
	private void setLoginModel() {
		this.loginModel = new LoginModel();
	};
	
	private void setLoginController() {
		this.loginController = new LoginController(this.loginModel);
	};
	
	/**
	 * The program's entry point.
	 * It just creates a new object of this class
	 * @param args
	 */
	public static void main(String[] args) {
		new LoginGUI();
	}
	
	/**
	 * Initializes the JFrame
	 */
	private void init(){
		super.setResizable(false);
		super.setTitle(GUI_NAME);
		super.setSize(GUI_WIDTH, GUI_HEIGHT);
		super.setLocationRelativeTo(null);
		super.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		super.setVisible(true);
	}

}
